<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
    <script type="text/javascript" th:src="@{https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js}"></script>
    <link th:href="@{https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/default.css}" rel="stylesheet"/>
    <link rel="icon" th:href="@{/images/favicon.ico}" type="image/x-icon"/>
    <meta charset="UTF-8"/>
    <title>用户列表</title>
</head>

<body>

<div class="contentDiv">

    <h5> 《 Spring Boot 2.x 核心技术实战》第二章快速入门案例</h5>

    <form th:action="@{/User}" method="post" class="form-horizontal" id="Search_form">
        <input type="hidden" id="hidPageNum" name="pageNum" th:value="${pageInfo.pageNum}"/>

        <div class="form-group">
            <label for="user_name" class="col-sm-2 control-label">用户名</label>
            <div class="col-xs-4">
                <input type="text" class="form-control" id="user_name" name="userName" th:value="${user.userName}"/>
            </div>
            <div class="col-xs-4">
                <input class="btn btn-primary" type="button" onclick="doSearch(1);" value="查询"/>
            </div>
        </div>
    </form>

    <div class="col-md-12 col-sm-12 col-xs-12">
        <table class="table table-hover table-condensed">
            <legend>
                <strong>用户列表</strong>
            </legend>
            <thead>
            <tr>
                <th>用户编号</th>
                <th>名称</th>
                <th>密码</th>
                <th>管理</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="user : ${pageInfo.list}">
                <th scope="row" th:text="${user.userId}"></th>
                <td><a th:href="@{/User/update/{userId}(userId=${user.userId})}" th:text="${user.userName}"></a></td>
                <td th:text="${user.password}"></td>
                <td><a class="btn btn-danger" th:href="@{/User/delete/{userId}(userId=${user.userId})}">删除</a></td>
            </tr>
            </tbody>
        </table>
    </div>

    <div class="col-md-12 col-sm-12 col-xs-12">
        <div th:replace="_tableNav :: tableNav"></div>
    </div>

    <div><a class="btn btn-primary" href="/User/create" role="button">创建用户</a></div>
</div>

<script src="webjars/jquery/3.2.1/jquery.min.js" th:src="@{webjars/jquery/3.2.1/jquery.min.js}"
        type="text/javascript"></script>
<script th:src="@{js/tableNav.js}" type="text/javascript"></script>
</body>
</html>